<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <link
            rel="stylesheet"
            href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
        />
    </head>
    <body>
        <button onclick="fun()">dianji</button>
        <h1 class="animate__animated">An animated element</h1>
        <div id="box"></div>
    </body>
    <script>
        function fun() {
            document
                .getElementsByTagName('h1')[0]
                .classList.add('animate__hinge')
        }
    </script>
</html>
